//
//  TravellingCell.m
//  Travelling Together
//
//  Created by lanou3g on 15/11/27.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "TravellingCell.h"

@implementation TravellingCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.imgView = [[UIImageView alloc] init];
        [self.contentView addSubview:_imgView];
        
        self.titleLabel = [[UILabel alloc]init];
        [self.contentView addSubview:_titleLabel];
        
        self.dateLabel = [[UILabel alloc]init];
        [self.contentView addSubview:_dateLabel];
        
        self.headView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.headView];

        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.imgView.frame = CGRectMake(CGRectGetMinX(self.contentView.frame) + 5, CGRectGetMinY(self.contentView.frame), CGRectGetWidth(self.contentView.frame) - 5, CGRectGetHeight(self.contentView.frame) - 5);
//        _imgView.backgroundColor = [UIColor yellowColor];
    
    self.titleLabel.frame = CGRectMake(5, 5, 300, 30);
//        self.titleLabel.backgroundColor = [UIColor blueColor];
    
    self.dateLabel.frame = CGRectMake(CGRectGetMinX(_titleLabel.frame), CGRectGetMaxY(_titleLabel.frame) + 2, 200, 15);
//    self.dateLabel.backgroundColor = [UIColor redColor];
    
    self.headView.frame = CGRectMake(CGRectGetMinX(self.dateLabel.frame)+10,self.contentView.frame.size.height - 50, 40, 40);
    self.headView.backgroundColor = [UIColor redColor];
    
    
    
}
- (void)select:(id)sender
{
    self.imgView.frame = CGRectMake(CGRectGetMinX(self.contentView.frame) + 5, CGRectGetMinY(self.contentView.frame), CGRectGetWidth(self.contentView.frame) - 5, CGRectGetHeight(self.contentView.frame) - 5);
    //        _imgView.backgroundColor = [UIColor yellowColor];
    
    self.titleLabel.frame = CGRectMake(5, self.imageView.frame.size.height-60, 300, 35);
    //        self.titleLabel.backgroundColor = [UIColor blueColor];
    
    self.dateLabel.frame = CGRectMake(5, self.imageView.frame.size.height - 23 , 300, 22);
    //    self.dateLabel.backgroundColor = [UIColor redColor];
}

+(CGFloat)cellHeight
{
    return 120;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
